﻿using System;
using System.Collections.Generic;
using AdaptiveAgents.Agents;
using AdaptiveAgents.Loggers;
using AdaptiveAgents.TeammateModels;

namespace AdaptiveAgents.Games
{
    /// <summary>
    /// A game created to check how good \ bad will an agent with "AdaptiveNoRaiseCompetenceTeammateModel" do
    /// </summary>
    class MDPNoRaiseCompetenceGame : MDPGame_old
    {
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="env">EnvironmentType</param>
        /// <param name="numOfRounds">Number of rounds</param>
        public MDPNoRaiseCompetenceGame(Environment env, int numOfRounds)
            : base(env, numOfRounds)
        { }

        /// <summary>
        /// Initialize the agents playing the game
        /// </summary>
        /// <param name="logger">Logger</param>
        /// <param name="numOfAgents">number of agents in the game</param>
        protected override void initializeGame(Logger logger, int numOfAgents)
        {
            //Initialize teammate model in each agent
            foreach (Agent agent in _environment.agents)
                agent.initializeTeammateModels(numOfAgents);

            //set agent 0 as adaptive
            List<TeammateModel> teammateModels = new List<TeammateModel>();
            for (int i = 0; i < _environment.agents.Count; i++)
            {
                Agent ag = _environment.agents[i];
                //model the other agents with "AdaptiveNoRaiseCompetenceTeammateModel"
                AdaptiveNoRaiseCompetenceTeammateModel teammate = new AdaptiveNoRaiseCompetenceTeammateModel(_environment.agents[0], ag, _environment);
                teammateModels.Add(teammate);
            }
            _environment.agents[0].TeammateModels = teammateModels;
        }
    }
}
